export const getAjax = function(url, params){
  return new Promise((resolve, reject)=>{
    wx.request({
      url: url,
      data: params,
      method: 'GET',
      header: {
        'content-type': 'application/json'
      },
      success(res) {
        resolve(res)
      },
      fail(error){
        reject(error)
      }
    })
  })
}

export const postAjax = function (url, params) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: url,
      data: params,
      method: 'POST',
      header: {
        'content-type': 'application/json'
      },
      success(res) {
        resolve(res)
      },
      fail(error) {
        reject(error)
      }
    })
  })
}